refactor(backend): split calls.go and middleware.go by concern#24
Merged
Conversation
internal/handler/calls/calls.go (1518 LOC) split into: - calls.go (104) — Handler struct, New(), getLimiter, apiKeyLimiter, consts - upload.go (833) — PostCallUpload + helpers - audio.go (113) — GetCallAudio - search.go (440) — GetCalls - transcript.go (80) — GetCallTranscript internal/middleware/middleware.go (392 LOC) split into: - middleware.go (2) — package doc only - cors.go (69) — CORS - auth.go (192) — JWTAuth, OptionalJWTAuth, RequireAdmin, APIKeyAuth, SwaggerCookieAuth - logging.go (73) — RequestID, Logger, requestLogLevel - limits.go (83) — RateLimit, MaxBodySize, RateLimitByIP Same package, same exports, no behaviour change. go vet, go build, go test ./... all pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two mechanical file-level splits. No public API changes; no behaviour changes. Same packages, same exported types and functions.
Files
internal/handler/calls/calls.go— 1518 LOCcalls.go(104) Handler/New/limiter •upload.go(833) PostCallUpload + helpers •audio.go(113) GetCallAudio •search.go(440) GetCalls •transcript.go(80) GetCallTranscriptinternal/middleware/middleware.go— 392 LOCmiddleware.go(2) package doc •cors.go(69) CORS •auth.go(192) JWTAuth + OptionalJWTAuth + RequireAdmin + APIKeyAuth + SwaggerCookieAuth •logging.go(73) RequestID + Logger •limits.go(83) RateLimit + MaxBodySize + RateLimitByIPVerification
cd backend && go vet ./...— cleancd backend && go build ./...— cleancd backend && go test ./...— all pass (handler/calls, middleware, full suite)No public API changes; no behaviour changes.